﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AUSRIS.Data.Web.Target.ReportingServices;
using DevExpress.Web.ASPxEditors;
using AUSRIS.Data.Web.ReportService2005;

namespace AUSRIS.Data.Web
{
	public partial class Reports : System.Web.UI.Page
	{
		protected void Page_Load(object sender, EventArgs e)
		{
			LoadReports();
		}

		private void LoadReports()
		{
			CookieAuthenticationServer rs = new CookieAuthenticationServer();
			rs.Initialize("https://ausris-integration.maxwell.af.mil/ReportServer/ReportService2005.asmx");
			if(rs.CanConnect())
			{
				this.lbReports.Items.Clear();
				foreach(CatalogItem item in rs.ListChildren("/", true))
				{
					this.lbReports.Items.Add(new ListEditItem(item.Name, item));
				}
			}
			else
			{
				this.lbReports.Items.Clear();
				this.lbReports.Items.Add(new ListEditItem("Can't Connect"));
			}
		}
	}
}